package com.cc.service.impl;

import com.cc.entity.Student;
import com.cc.mapper.StudentMapper;
import com.cc.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentMapper studentMapper;
    @Transactional
    @Override
    public List<Student> selectAllStudents() {
        return studentMapper.selectAllStudents();
    }
    @Transactional
    @Override
    public Student selectStudentById(Long id) {
        return studentMapper.selectStudentById(id);
    }
    @Transactional
    @Override
    public boolean insertStudent(Student student) {
        return studentMapper.insertStudent(student)>0;
    }
    @Transactional
    @Override
    public boolean updateStudent(Student student,Long id) {
        return studentMapper.updateStudent(student,id)>0;
    }
    @Transactional
    @Override
    public boolean deleteStudent(Long id) {
        return studentMapper.deleteStudent(id)>0;
    }
}
